//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    sexItems: [
      { value: 'male', name: '男' },
      { value: 'female', name: '女' }
    ],
    region: [],
    region1: [],
    jobArray: ['请选择', '教学老师', '教务老师', '教学主管', '教务主管', '学校校长', '学校创办人'],
    jobIndex: 0,
    teachAgeItems: [
      { value: 'less-one-year', name: '少于1年' },
      { value: 'one-two-year', name: '1-2年' },
      { value: 'two-five-year', name: '2-5年' },
      { value: 'five-ten-year', name: '5-10年' },
      { value: 'over-ten-years', name: '10年以上' },
    ],
    learnAgeItems: [
      { value: 'child', name: '幼儿阶段3-6岁' },
      { value: 'juvenile', name: '少儿阶段6-12岁' },
      { value: 'junior-middle', name: '初中阶段12-15岁' },
      { value: 'other', name: '其他' },
    ],
    testItems: [
      { value: '2019-12', name: '2019年-12月' },
      { value: '2020-3', name: '2020年-3月' },
      { value: '2020-6', name: '2020年-6月' },
    ],
    tccItems: [
      { value: 'tcc-one', name: '第二语言学习概论 Introduction to Second Language Acquisition' },
      { value: 'tcc-two', name: '语言教学方法 Language Teaching Methodology' },
      { value: 'tcc-three', name: '英语发音教学 Teaching Pronunciation' },
      { value: 'tcc-four', name: '写作教学 Teaching Writing' },
      { value: 'tcc-five', name: '故事教学 Using Stories & Drama Techniques' },
      { value: 'tcc-six', name: '词汇教学 Teaching Vocabulary' },
      { value: 'tcc-seven', name: '规范之课堂用语 Appropriate Classroom Language' },
      { value: 'tcc-eight', name: '备课及课程设计 Lesson Planning' },
    ],
    ocItems: [
      { value: 'oc-one', name: 'ATM教学法系统课程 Acquisition' },
      { value: 'oc-two', name: '启蒙英语写作 Writing Courses' },
      { value: 'oc-three', name: '建构绘本阅读教学体系 Stories Reading Structure' },
      { value: 'oc-four', name: '自然拼读零基础课程 Phonics System---Beginner' },
      { value: 'oc-five', name: '自然拼读与绘本阅读 Phonics and Stories' },
      { value: 'oc-six', name: '启蒙英语的100本经典绘本 100 Classic Stories' },
      { value: 'oc-seven', name: '300个英语教学大能力 300 Fundamental Teaching Skills' },
      { value: 'oc-eight', name: '启蒙绘本故事家 Fundamental Stories' },
    ],
    offLineChecked: false,
    assChecked: false,
  },
  sexRadioChange: function (e) {
    var items = this.data.sexItems;
    for (var i = 0, len = items.length; i < len; ++i) {
      items[i].checked = items[i].value == e.detail.value
    }
    this.setData({
      sexItems: items
    });
  },
  bindRegionChange: function (e) {
    this.setData({
      region: e.detail.value
    })
  },
  bindPickerChange: function (e) {
    this.setData({
      jobIndex: e.detail.value
    })
  },
  teachAgeRadioChange: function (e) {
    var items = this.data.teachAgeItems;
    for (var i = 0, len = items.length; i < len; ++i) {
      items[i].checked = items[i].value == e.detail.value
    }
    this.setData({
      teachAgeItems: items
    });
  },
  learnAgeRadioChange: function (e) {
    var items = this.data.learnAgeItems;
    for (var i = 0, len = items.length; i < len; ++i) {
      items[i].checked = items[i].value == e.detail.value
    }
    this.setData({
      learnAgeItems: items
    });
  },
  bindRegionChange1: function (e) {
    this.setData({
      region1: e.detail.value
    })
  },
  testRadioChange: function (e) {
    var items = this.data.testItems;
    for (var i = 0, len = items.length; i < len; ++i) {
      items[i].checked = items[i].value == e.detail.value
    }
    this.setData({
      testItems: items
    });
  },
  tccRadioChange: function (e) {
    var items = this.data.tccItems, values = e.detail.value;
    for (var i = 0, lenI = items.length; i < lenI; ++i) {
      items[i].checked = false;
      for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
        if (items[i].value == values[j]) {
          items[i].checked = true;
          break
        }
      }
    }
    this.setData({
      tccItems: items
    })
  },
  ocRadioChange: function (e) {
    var items = this.data.ocItems, values = e.detail.value;
    for (var i = 0, lenI = items.length; i < lenI; ++i) {
      items[i].checked = false;
      for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
        if (items[i].value == values[j]) {
          items[i].checked = true;
          break
        }
      }
    }
    this.setData({
      ocItems: items
    })
  },
  bindOffLineCheck: function (e) {
    this.setData({
      offLineChecked: true
    })
  },
  offLineCancel: function (e) {
    this.setData({
      offLineChecked: false
    })
  },
  bindassCheck: function (e) {
    this.setData({
      assChecked: true
    })
  },
  assCancel: function (e) {
    this.setData({
      assChecked: false
    })
  }
})
